﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Domain.Model;
using Gmmy.RepositoryExtension;
using Gmmy.Utility;
using Infrastructure;
using Microsoft.EntityFrameworkCore;

namespace Infrastructure.Repository
{
    public class EfContext : BaseDbContext
    {
        public EfContext(DbContextOptions options) : base(options) { }
        #region 实体引用
        public DbSet<SampleModel> SampleModel { get; set; }
        
        #endregion 
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            #region old code

            //指定实体字段保留小数位数
            //modelBuilder.Entity<Experience>().Property(a => a.dlongitude).HasPrecision(18, 6);
            //modelBuilder.Entity<Experience>().Property(a => a.dlatitude).HasPrecision(18, 6);

            //解除实体与数据库之间的映射
            //modelBuilder.Entity<Project_SYS_Province>().Ignore(p => p.PyProvinceName);
            //modelBuilder.Entity<Project_SYS_City>().Ignore(p => p.PyCityName);
            #endregion
        }
    }
}
